<template>
  <div class="home" id="aaa">
    This is an Home
  </div>
  <div style="display: flex;justify-content: center;align-items: center   ;">
  <el-form :model="form" label-width="auto" style="max-width: 600px">
    <el-form-item label="用户名">
      <el-input v-model="form.id" />
    </el-form-item>
    
    <el-form-item label="密码">
      <el-input v-model="form.pwd" />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">Create</el-button>
    </el-form-item>
   
  </el-form>
</div>

</template>

<script lang="ts" setup>
import { reactive } from 'vue';
import axios from 'axios';
import {ref} from 'vue';
// do not use same name with ref
const form = reactive({
  id: '',
  pwd: '',
})
let p = ref("");

const onSubmit = async () => {
  try {
      const response = await axios.get('http://localhost:8888/user/login', {
        params: {
          id: form.id,
          name: form.pwd
        }
      });
    } catch (error) {
      console.error(error);
    }
  };

</script>


<style scoped>
@media (min-width: 1024px) {
  .home {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
